import http from '@/utils/request'

/**
 * @description 新增地址
 * @param {*} address 新增的地址
 * @returns Promise
 */
export const reqAddAddress = (address) => {
  return http.post('/userAddress/save', address)
}

/**
 * @description 获取用户地址列表
 * @returns Promise
 */
export const reqUserAddress = () => {
  return http.get('/userAddress/findUserAddress')
}

/**
 * @description 获取收货地址详情
 * @param {*} id 地址id
 * @returns Promise
 */
export const reqAddressDetail = (id) => {
  return http.get(`/userAddress/${id}`)
}

/**
 * @description 修改地址信息
 * @param {*} address 修改的地址
 * @returns Promise
 */
export const reqUpdateAddress = (address) => {
  return http.post('/userAddress/update', address)
}

/**
 * @description 删除地址
 * @param {*} id 地址id
 * @returns Promise
 */
export const reqDeleteAddress = (id) => {
  return http.get(`/userAddress/delete/${id}`)
}
